import axios from "axios";
import * as constants from './constants';

const changeLogin = ()=>({
    type:constants.CHANGE_LOGIN,
    value:true
})

export const logout = ()=>({
    type:constants.CHANGE_LOGOT,
    value:false
})

export const login = (account,password)=>{
    return (dispatch)=>{
        axios.get('/api/login.json?account='+account+'&passwprd='+password).then((res)=>{
            const result = res.data.data;
            dispatch(changeLogin())//派发action去改变登录状态
        }).catch(()=>{

        })
    }
}